import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

export default defineConfig({
  plugins: [vue()],
  base: "./", // 控制公共资源的基础路径
  resolve: {
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  build: {
    // assetsPublicPath 已废弃，可使用 base 控制整体路径，或使用 assetsDir 设置资源存放目录
    assetsDir: "assets", // 可选，默认就是 'assets'
  },
  server: {
    proxy: {
      "/api": {
        target: "http://example.com/",
        changeOrigin: true,
      },
    },
  },
});
